/**
 * Created by Administrator on 2016/6/23 0023.
 */
$().ready(function () {
	$('.change').on('tap', function() {
		var language = $(this).attr("language");
		language = 'en_US';
		$.ajax({
			url: MPJ.base + "/language",
			data:{language:language},
			success: function() {
				window.location.reload();
			}
		});
	});
		//购物车点击
	$('.shopcar').on('tap', function() {
		//getAjaxRequest({hf_s_id:"WD11",hf_srv_id:"Zv_jcus_is_login"},function(result){
		//	if(result.bs_is_login==BS_IS_LOGIN.Y){
				location.href = MPJ.base + "/pages/cart/list.jsp";
			//}
		//});
	});
	//点击LOGO跳首页
	$(".logo").on('tap', function() {
		window.location.href = MPJ.base+ '/';
	});

	//搜索
	var searchBar = $(".searchBar");
	var nowUrl=window.location.pathname;
	var splitStr=nowUrl.substring(nowUrl.lastIndexOf('/')+1, nowUrl.lastIndexOf('.'));
	if(splitStr=="search-result"){
		$(".searchicon").off('tap');
	}else{
		$(".searchicon").on('tap', function() {
			if (searchBar.css('display') == "none") {
				$(this).css('background', '#0e3120');
				searchBar.fadeIn();
			} else {
				searchBar.fadeOut();
				$(this).css('background', 'none');
			}
		})
	}

	//查看更多
	$(".more").on('tap', function() {
		getAjaxRequest({hf_s_id:"WD11",hf_srv_id:"Zv_jcus_is_login"},function(result){
			if(result.bs_is_login==BS_IS_LOGIN.Y){
				window.location.href = MPJ.base+'/pages/account/index.jsp';
			}else if(result.bs_is_login==BS_IS_LOGIN.N){
				window.location.href = MPJ.base+'/pages/login.jsp';
			}
		}, null, true);
	})

});